package cn.wolfcode.trip.base.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.springframework.util.StringUtils;

import java.util.Date;

/**
 * 点评
 */
@Setter
@Getter
public class StrategyComment extends BaseDomain{
    public static final int STATE_COMMON = 0;//普通
    public static final int STATE_RELEASE = 1;//推荐
    public static final int STATE_DISABLE = -1;//禁用
    //用户
    private User user;
    //创建时间
    private Date createTime;
    //评论内容
    private String content;
    //背景图片
    private String imgUrls;
    //评论星级
    private Integer starNum;
    //大攻略
    private Strategy strategy;
    //状态
    private Integer state;
    //评论时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date commendTime;
    //切割图片
    public String[] getImgArr(){
        if (StringUtils.hasLength(imgUrls)) {
            return imgUrls.split(";");
        }
        return null;
    }
}